From e32d4f83f034707276f65b3d03d0260a814bb109 Mon Sep 17 00:00:00 2001 From: "mafetter@fleming.research" Date: Fri, 29 Oct 2004 08:31:40 +0000 Subject: [PATCH] bitkeeper revision 1.1159.140.2 (4181ffecq3PQVDZfRw16mEwphHTvbw) Added comments to document the not-so-obvious reference count sleight-of-hand in construct_dom0(). --- xen/arch/x86/domain.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 98e5438497..f635caac25 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -770,7 +770,14 @@ int construct_dom0(struct domain *p, { page->u.inuse.type_info &= ~PGT_type_mask; page->u.inuse.type_info |= PGT_l2_page_table; + + /* + * No longer writable: decrement the type_count. + * Installed as CR3: increment both the ref_count and type_count. + * Net: just increment the ref_count. + */ get_page(page, p); /* an extra ref because of readable mapping */ + /* Get another ref to L2 page so that it can be pinned. */ if ( !get_page_and_type(page, p, PGT_l2_page_table) ) BUG(); @@ -783,6 +790,12 @@ int construct_dom0(struct domain *p, page->u.inuse.type_info |= ((dsi.v_start>>L2_PAGETABLE_SHIFT)+(count-1))<